import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { library } from '@fortawesome/fontawesome-svg-core';
import { fas } from '@fortawesome/free-solid-svg-icons';
import { far } from '@fortawesome/free-regular-svg-icons';
import React from 'react';
import type { IconProp } from '@fortawesome/fontawesome-svg-core'; // 导入官方类型

library.add(fas, far);

interface IconProps {
    icon: IconProp; // 使用官方提供的 IconProp 类型
    className?: string;
}

export default function Icon({ icon, className = '' }: IconProps) {
    return <FontAwesomeIcon icon={icon} className={className} />;
}
